<template>
  <div>
    <span v-for="(item, index) in arr" :key="index">
      <input v-model="myArr" type="checkbox" :value="item" />
      <span>{{ item }}</span>
    </span>
    <p>你选中的元素，累加的和为：{{ sum }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [1, 3, 4, 2, 7, 8, 5, 0, 6],
      myArr: [],
    };
  },
  computed: {
    sum() {
      return this.myArr.reduce((sum, obj) => (sum += obj), 0);
    },
  },
};
</script>

<style>
</style>